﻿using JJCraft;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace JJCraftUnitTests
{
    
    
    /// <summary>
    ///This is a test class for LogParserTest and is intended
    ///to contain all LogParserTest Unit Tests
    ///</summary>
    [TestClass()]
    public class LogParserTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for ParseLine
        ///</summary>
        [TestMethod()]
        public void ParseLineTest()
        {
            // case 1
            {
                LogReader target = new LogReader();
                string line = "";

                LogLine actual;
                actual = target.ReadLine(line);

                Assert.AreEqual(false, actual.Success);
            }

            // case 2
            {
                LogReader target = new LogReader();
                string line = "1/1 21:15:31.642  SPELL_AURA_REMOVED,0x0380000000E78F3B,\"薇熏之吻\",0x548,0x0380000000E78F3B,\"薇熏之吻\",0x548,39953,\"阿达尔的战歌\",0x1,BUFF";

                LogLine actual;
                actual = target.ReadLine(line);

                Assert.AreEqual(true, actual.Success);
                Assert.AreEqual(new DateTime(2010, 1, 1, 21, 15, 31, 642), actual.Time);
                Assert.AreEqual(11, actual.Parameters.Length);
            }
        }
    }
}
